package com.cf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cf.domain.pojo.Judges;
import com.cf.domain.pojo.PageQuery;
import com.cf.domain.pojo.ScoreOptions;
import com.cf.domain.vo.TeamVO;
import com.cf.mapper.ScoreOptionsMapper;
import com.cf.service.IScoreOptionsService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author lzqinga@126.com
 * @Date 2024/11/9  10:51
 */
@Service
@RequiredArgsConstructor
public class ScoreOptionsServiceImpl extends ServiceImpl<ScoreOptionsMapper, ScoreOptions> implements IScoreOptionsService {

    private final ScoreOptionsMapper scoreOptionsMapper;
    @Override
    public Page<ScoreOptions> selectAllScoreOptions(PageQuery pageQuery) {
        Page<ScoreOptions> page = new Page<>(pageQuery.getPageNo(), pageQuery.getPageSize());
        return scoreOptionsMapper.selectList(page, null);
    }

    @Override
    public List<ScoreOptions> listByType(Integer type) {
        QueryWrapper<ScoreOptions> wrapper = new QueryWrapper<>();
        wrapper.eq("enable", 0).eq("type", type);
        wrapper.orderByAsc("id");
        return scoreOptionsMapper.listByType(wrapper);
    }
}
